package com.by.my;

import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    /**
     * mybatis java 配置文件
     * @return
     */
    @Bean
    public ConfigurationCustomizer configurationCustomizer() {

        return new ConfigurationCustomizer() {
            @Override
            public void customize(org.apache.ibatis.session.Configuration conf) {
                //自定义配置
              //  conf.addInterceptor(queryIntercepter());
                //查询字段自动转驼峰标识
	            conf.setMapUnderscoreToCamelCase(true);
                //开启二级缓存
	            conf.setCacheEnabled(true);
            }
        };
    }

    @Bean
    public QueryIntercepter queryIntercepter() {
        return new QueryIntercepter();
    }

	/*@Bean
	public QueryIntercepter3 queryIntercepter () {
		Properties properties = new Properties();
		properties.setProperty("name","chenxiodng");
		QueryIntercepter3 a = new QueryIntercepter3();
		a.setProperties(properties);
		return a;
	}*/

   /* @Bean
    public QueryIntercepter2 queryIntercepter2 () {
        return new QueryIntercepter2();
    }*/


}
